package cn.tedu.controller;

import cn.tedu.dao.BannerDao;
import cn.tedu.dao.ShowDao;
import cn.tedu.entity.Banner;
import cn.tedu.entity.Show;
import cn.tedu.utils.ThUtils;
import org.thymeleaf.context.Context;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "GuestServlet",urlPatterns = "/guest")
public class GuestServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Context context = new Context();
        ShowDao sDao = new ShowDao();
        List<Show> sList = sDao.findAll();
        context.setVariable("sList",sList);
        ThUtils.print("guest.html",context,response);
    }
}
